package com.bbs.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.ApplicationMap;
import org.apache.struts2.dispatcher.SessionMap;
import org.apache.struts2.interceptor.ApplicationAware;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;


import com.bbs.util.LogUtil;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport implements ServletRequestAware,
		SessionAware, ApplicationAware {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ActionContext context;
	private HttpServletRequest request;
	private SessionMap<String, Object> sessionMap;
	protected Logger logger = Logger.getLogger(BaseAction.class);
	private ApplicationMap applicationMap;
	
	//构造方法
	public BaseAction() {
		super();
		new LogUtil().initializeLogger();//初始化log4j
	}

	public ActionContext getContext() {
		return context;
	}

	public void setContext(ActionContext context) {
		this.context = context;
	}

	public HttpServletRequest getRequest() {
		return request;
	}

	
	public SessionMap<String, Object> getSessionMap() {
		return sessionMap;
	}

	
	public ApplicationMap getApplicationMap() {
		return applicationMap;
	}

	

	public void setApplication(ApplicationMap applicationMap) {
		this.applicationMap = applicationMap;
	}

	public void setSession(SessionMap<String, Object> sessionMap) {
		this.sessionMap = sessionMap;
	}


	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}

	public void setSession(Map<String, Object> session) {
		this.sessionMap = (SessionMap<String, Object>) session;
	}

	public void setApplication(Map<String, Object> appMap) {
		this.applicationMap = (ApplicationMap) appMap;
	}

}
